package com.shawn.integeration.business.user.controller;

import com.shawn.springboot.integeration.dubbo.api.common.Response;
import com.shawn.springboot.integeration.dubbo.api.user.IUserService;
import com.shawn.springboot.integeration.dubbo.api.user.dto.UserReqDTO;
import com.shawn.springboot.integeration.dubbo.api.user.dto.UserResDTO;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shawn
 * @description: TODO
 * @date 2024/1/6
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @DubboReference(interfaceClass = IUserService.class, version = "1.0.0")
    private IUserService userService;

    @GetMapping("/select/{userId}")
    public Response<UserResDTO> queryById(@PathVariable("userId") String userId) {
        UserReqDTO req = UserReqDTO.builder().userId(userId).build();
        return userService.queryUserInfo(req);
    }
}
